package com.bianguo.android.tencentpushdemo.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bianguo.android.tencentpushdemo.R;
import com.bianguo.android.tencentpushdemo.entity.PageData;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.BindViews;

/**
 * Created by Administrator on 2018/7/4.
 */

public class PageAdapter extends BaseRecyclerViewAdapter<PageData> {

    public PageAdapter(Context mContext, ArrayList<PageData> list) {
        super(mContext, list);
    }

    @Override
    public BaseViewHolder createHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.item_page_layout, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void bindHolder(BaseViewHolder holder, int position) {
        ViewHolder viewHolder = (ViewHolder) holder;
        PageData pageData = list.get(position);
        ArrayList<String> datas = pageData.getDatas();
        int size = datas.size();
        for (int i = 0; i < size; i++) {
            viewHolder.tvs.get(i).setText(datas.get(i));
        }
    }

    public static class ViewHolder extends BaseViewHolder {

        @BindViews({R.id.item_page_tv1, R.id.item_page_tv2, R.id.item_page_tv3,
                R.id.item_page_tv4, R.id.item_page_tv5, R.id.item_page_tv6,
                R.id.item_page_tv7})
        List<TextView> tvs;

        public ViewHolder(View itemView) {
            super(itemView);
        }
    }
}
